public class Node extends Tile {

	public int gCost;
	public int fCost;
	public boolean openList;
	
	public Node previous;
	public Node next;

	public Node(int row, int col) {	
		this(row, col, 0, 0);
	}
	
	public Node(int row, int col, int gCost, int fCost) {
		super(row, col);
		this.gCost = gCost;
		this.fCost = fCost;
	}
	
	public Node(Tile tile) {
		super(tile.getRow(), tile.getCol());
	}
	
	public void clear() {
		previous = null;
		next = null;
		gCost = 0;
		fCost = 0;
		openList = true;
	}

	@Override
	public int compareTo(Tile o) {
		if (o instanceof Node) {
			Node node = (Node) o;
			return (fCost - node.fCost);
		} else {
			throw new IllegalArgumentException(
					"Node cannot compare with a different class type.");
		}
	}
}
